package com.kaka.bus.engine.prompt;

import com.kaka.bus.bean.DrainProductBean;
import com.kaka.bus.bean.HttpWrapper;
import com.kaka.bus.constant.Constant;
import com.kaka.bus.di.DataManager;
import com.kaka.bus.engine.common.impl.LoanService;
import com.kaka.bus.manager.Result;
import com.kaka.bus.manager.T;
import com.kaka.bus.mvp.RxPresenter;
import com.kaka.bus.util.logger.Logger;

import java.util.List;

import javax.inject.Inject;

public class PromptPresenter extends RxPresenter<PromptContract.View> implements PromptContract.Presenter {
    private LoanService mLoanService;

    @Inject
    public PromptPresenter(DataManager dataManager, LoanService loanService) {
        super(dataManager);
        mLoanService = loanService;
        setService(mLoanService);
    }

    @Override
    public void getTailProduct() {

        addSubscribe(mDataManager.getApi()
                .getTailProduct("")
                .compose(T.D())
                .subscribeWith(new Result<HttpWrapper<List<DrainProductBean>>>() {
                    @Override
                    protected void onSuccess(HttpWrapper<List<DrainProductBean>> s) {

                        mView.getTailProductSuccess(s);
                    }

                    @Override
                    protected void onFaild() {
                        super.onFaild();
                        mView.getTailProductfail();
                    }
                }));

    }
}
